'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
    const { router, controller } = app;
    /**  定义访问路径  **/

    router.get('/', app.middleware.checksession(),controller.home.index)
    router.get('/cookie', controller.home.cookiePage);
    router.get('/session', controller.home.sessionPage);
    router.get('/login', controller.login.index);
    router.post('/login', controller.login.doLogin);

    // 获取数据
    router.get('/fruit', controller.fruit.getData);
    // 插入数据
    router.post('/fruit', controller.fruit.insertData);
    // 删除数据
    router.delete('/fruit/:id', controller.fruit.deleteData);
    // 更新数据
    router.put('/fruit/:id', controller.fruit.modifyData);
};
